import numpy as np
import pylab as pl
from pylab import *
import matplotlib.pyplot as pyplot

data01 = np.loadtxt('fig8a.dat')
data02 = np.loadtxt('fig8b.dat')

fig1, axes = plt.subplots(nrows=2, ncols=1,figsize=(10,12))
pl.subplots_adjust(left=0.152, bottom=0.145, right=0.82, top=0.967, 
                   wspace=0.2, hspace=0.03)

#----------------------------subfigure 1---------------------------
plt.subplot(2,1,1)
rc('axes', linewidth=1)
pl.xlim(0.55, 1.01)
pl.ylim(0.0, 2.5)
pl.xticks([0.6,0.7,0.8,0.9,1],['','','','',''], fontsize =26)
pl.yticks([0,0.5,1,1.5,2,2.5],['0','','1','','2',''], fontsize = 26)
pl.ylabel(r'$|S(\pi,\pi)|,\;\kappa$', fontsize=26, weight='bold',fontstyle='italic')

ax = gca()

pl.plot(data01[:,0], data01[:,1], 'b-',linewidth=3.0)#,label = '$E$_CDW')
pl.plot(data01[:,0], data01[:,3], 'g-',linewidth=3.0)#,label = '$E$_CDW')
plt.plot([0.91,0.91],[0,2.5],'--',color = 'gray', linewidth=3)
plt.plot([0.59,0.59],[0,2.5],'--',color = 'gray', linewidth=3)
plt.text(0.92, 2.1, r'(a)', color='black', rotation = 0, fontsize = 20)


ax3 = axes[0].twinx()
ax3.set_ylim(0,0.0025)
ax3.set_ylabel(r'$\Phi$ ', fontsize=26, weight='bold')
pl.yticks([0,0.0005,0.001,0.0015,0.002,0.0025],['0.000','','0.001','','0.002',''], fontsize = 26)
ax3.plot(data01[:,0], (data01[:,2]),'r-',linewidth=3.0)

#----------------------------subfigure 2---------------------------
plt.subplot(2,1,2)
rc('axes', linewidth=1)
pl.xlim(0.55, 1.01)
pl.ylim(0.0, 2.5)
pl.xticks([0.6,0.7,0.8,0.9,1],['0.6','0.7','0.8','0.9','1.0'], fontsize =26)
pl.yticks([0,0.5,1,1.5,2,2.5],['0','','1','','2',''], fontsize = 26)
pl.xlabel(r'$\mu/U$', fontsize=26, weight='bold',fontstyle='italic')
pl.ylabel(r'$|S(\pi,\pi)|,\;\kappa$', fontsize=26, weight='bold',fontstyle='italic')


ax = gca()

pl.plot(data02[:,0], data02[:,1], 'b-',linewidth=3.0)#,label = '$E$_CDW')
pl.plot(data02[:,0], data02[:,3], 'g-',linewidth=3.0)#,label = '$E$_CDW')
plt.plot([0.89,0.89],[0,2.5],'--',color = 'gray', linewidth=3)
plt.plot([0.59,0.59],[0,2.5],'--',color = 'gray', linewidth=3)
plt.text(0.92, 2.1, r'(b)', color='black', rotation = 0, fontsize = 20)


ax3 = axes[1].twinx()
ax3.set_ylim(0,0.001)
ax3.set_ylabel(r'$\Phi$ ', fontsize=26, weight='bold')
pl.yticks([0, 0.0002, 0.0004,0.0006,0.0008,0.001],['0.0000', '', '0.0004','','0.0008',''], fontsize = 26)
ax3.plot(data02[:,0], (data02[:,2]),'r-',linewidth=3.0)


fig1.savefig('cgmf_kappa_strfac.pdf')
pl.show()
